# Maintainer: Patrycja Rosa <alpine@ptrcnull.me>
pkgname=turnstile
pkgver=0.1.10
pkgrel=3
pkgdesc="Independent session/login tracker"
url="https://github.com/chimera-linux/turnstile"
arch="all"
license="BSD-2-Clause"
makedepends="
	linux-pam-dev
	meson
	scdoc
	"
subpackages="$pkgname-doc $pkgname-openrc"
source="$pkgname-$pkgver.tar.gz::https://github.com/chimera-linux/turnstile/archive/refs/tags/v$pkgver.tar.gz
	turnstiled.confd
	turnstiled.initd

	no-system-dinit.patch
	"
options="!check" # no tests

build() {
	abuild-meson \
		-Db_lto=true \
		-Ddinit=enabled \
		-Dmanage_rundir=true \
		. output
	meson compile -C output
}


package() {
	DESTDIR="$pkgdir" meson install --no-rebuild -C output

	install -Dm755 "$srcdir"/turnstiled.initd "$pkgdir"/etc/init.d/turnstiled
	install -Dm644 "$srcdir"/turnstiled.confd "$pkgdir"/etc/conf.d/turnstiled
}

sha512sums="
739e11a01cfcb6c7ae58445619e1986cc6a84f93eae4ebf36b76f1f003baec90bf357eb81da2c116df3564631dff7b3b97c0eb6878d2d14de6457ba66dad5068  turnstile-0.1.10.tar.gz
4798d04b707e3b44467c1e75481a5123dbf4755ef1bdd09ac31d180762f67085a7030c4ba7d1f27b1ef30910785d8739375a730f32647c7d554142fac4d6b824  turnstiled.confd
4824f233704b21e3a4ab931879f88ec716761065fd109038ea9a0c89383580c7a198e2372088b555cb894110b5067c26b99ac9c40c04bf9a2384af1417fa4ad0  turnstiled.initd
f40e665d87f3ea428463b4322e322165654bdde8ac85aee2ca1cff3108253caf9a9cb9aa54b9679582af1aae75eaccc725e6efe360fc83559260d18b85b3ccea  no-system-dinit.patch
"
